Skip to content

feat: Add custom_attributes field to OrganizationMembership#82

Open
ajworkos wants to merge 4 commits into
mainfrom
feature/add-idp-attributes-to-org-membership
Open

feat: Add custom_attributes field to OrganizationMembership#82
ajworkos wants to merge 4 commits into
mainfrom
feature/add-idp-attributes-to-org-membership

Conversation

@ajworkos

@ajworkos ajworkos commented Feb 1, 2026

Copy link
Copy Markdown

Summary

Adds custom_attributes field to OrganizationMembership model to expose custom attributes from identity providers.

Changes

  • Added custom_attributes field to OrganizationMembership type/model
  • Field type: Record/Map/Dictionary of string keys to any values
  • Always present, defaults to empty object {}
  • Updated fixtures and tests

API Field Details

The field will be present in:

  • REST API responses
  • Webhook events
  • Events API responses

JSON field name: custom_attributes (snake_case)

- Add idp_attributes: map() to type spec
- Add :idp_attributes to defstruct
- Add idp_attributes: map["idp_attributes"] || %{} to cast/1 with default empty map
- CI will run tests (local testing was not possible due to dependency issues)

This change adds support for IDP custom attributes on organization
memberships, which are sourced from the identity provider and stored
as customAttributes in the API.

Related to workos/workos PR #50470

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Feb 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds custom_attributes support to organization memberships. The main changes are:

  • Adds custom_attributes to the OrganizationMembership type and struct.
  • Maps the custom_attributes API response field with an empty-map fallback.
  • Updates the user management mock fixture and test coverage for the new field.

Confidence Score: 5/5

The change is narrowly scoped to exposing a new organization membership field and includes corresponding fixture/test updates.

The implementation appears straightforward, with no review comments left open from the code changes.

T-Rex T-Rex Logs

What T-Rex did

  • Captured the baseline state by recording the base commit source and the initial failed runtime attempts with exit code 127.
  • Captured the head commit state and the subsequent failed runtime attempts (exit code 127) after artifact collection.
  • Identified the blockers as '/bin/sh: elixir: not found' and '/bin/sh: mix: not found'.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "Add custom_attributes to organization me..." | Re-trigger Greptile

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment thread lib/workos/user_management/organization_membership.ex Outdated
@ajworkos ajworkos changed the title Add idp_attributes field to OrganizationMembership Add custom_attributes field to OrganizationMembership Feb 2, 2026
@gjtorikian

Copy link
Copy Markdown
Contributor

@ajworkos is this still something you'd like to see shipped? if so do you mind merging main and making greptile happy?

@devin-ai-integration devin-ai-integration Bot requested a review from a team as a code owner July 2, 2026 20:43
@devin-ai-integration devin-ai-integration Bot changed the title Add custom_attributes field to OrganizationMembership feat: Add custom_attributes field to OrganizationMembership Jul 2, 2026
@ajworkos

ajworkos commented Jul 2, 2026

Copy link
Copy Markdown
Author

Done @gjtorikian!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants